package cc.geguo.state;

import cc.geguo.client.VendingMachine;

/**
 * 作者  Administrator
 * 时间  2017/4/24 18:02
 * 文件  StatePatter
 * 描述
 */
public class NoMoneyState implements State {
	public NoMoneyState(VendingMachine machine) {
		this.machine = machine;
	}

	private VendingMachine machine;
	@Override
	public void insertMoney()
	{
		System.out.println("投币成功");
		machine.setState(machine.getHasMoneyState());
	}

	@Override
	public void backMoney()
	{
		System.out.println("您未投币，想退钱？...");
	}

	@Override
	public void turnCrank()
	{
		System.out.println("您未投币，想拿东西么？...");
	}

	@Override
	public void dispense()
	{
		throw new IllegalStateException("非法状态！");
	}

}
